/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf.views;

import com.openbrew.openbrewrf.Barrels;
import com.openbrew.openbrewrf.BrewLab;
import com.openbrew.openbrewrf.Firkins;
import com.openbrew.openbrewrf.TastePanelBeer;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "Brews")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BrewView.findAll", query = "SELECT b FROM BrewView b"),
    @NamedQuery(name = "BrewView.findAllInProduction", query = "SELECT b FROM BrewView b WHERE b.bState < '20'"),
    @NamedQuery(name = "BrewView.getPackagableBrews", query = "SELECT b FROM BrewView b WHERE b.bState='15' AND b.volLeft>'0'"),
    @NamedQuery(name = "BrewView.getALLBCSBeer", query = "SELECT b FROM BrewView b WHERE b.bState='25'")})
public class BrewView implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "BID")
    private Integer bid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BState")
    private int bState;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date bDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "VolLeft")
    private float volLeft;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttColor")
    private int ganttColor;
    @Column(name = "GanttStart")
    @Temporal(TemporalType.DATE)
    private Date ganttStart;
    @Column(name = "GanttSecond")
    @Temporal(TemporalType.DATE)
    private Date ganttSecond;
    @Column(name = "GanttCond")
    @Temporal(TemporalType.DATE)
    private Date ganttCond;
    @Column(name = "GanttStop")
    @Temporal(TemporalType.DATE)
    private Date ganttStop;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttPID")
    private int ganttPID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttSID")
    private int ganttSID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttCID")
    private int ganttCID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 250)
    @Column(name = "GanttFGI")
    private String ganttFGI;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttFilter")
    private boolean ganttFilter;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttHarvest")
    private boolean ganttHarvest;
    @Column(name = "GanttHarvestDate")
    @Temporal(TemporalType.DATE)
    private Date ganttHarvestDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "GanttFine")
    private boolean ganttFine;
    @Basic(optional = false)
    @NotNull
    @Column(name = "version")
    @Version
    private int version;
    @Basic(optional = false)
    @NotNull
    @Column(name = "origBrew")
    private int origBrew;
    @Column(name = "CTDate")
    @Temporal(TemporalType.DATE)
    private Date cTDate;
    @Column(name = "SFDate01")
    @Temporal(TemporalType.DATE)
    private Date sFDate01;
    @Column(name = "PDate")
    @Temporal(TemporalType.DATE)
    private Date pDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PFVID")
    private int pfvid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SFVID")
    private int sfvid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CVID")
    private int cvid;
    @Column(name = "BrewNoteID")
    private int brewNoteID;
    @Column(name = "BrewNoteID2")
    private int brewNoteID2;
    @Column(name = "BrewNoteID3")
    private int brewNoteID3;
    @Column(name = "BrewNoteID4")
    private int brewNoteID4;
    @Column(name = "BrewNoteID5")
    private int brewNoteID5;
    @Column(name = "BrewNoteID6")
    private int brewNoteID6;
    @JoinColumn(name = "BBeerID", referencedColumnName = "BId")
    @ManyToOne(optional = false)
    private POSBeerView bBeerID;
    @OneToMany(mappedBy = "brew", cascade = CascadeType.PERSIST)
    private Collection<Barrels> barrelCollection;
    @OneToMany(mappedBy = "tPBBatch")
    private Collection<TastePanelBeer> tastePanelBeerCollection;
    @OneToMany(mappedBy = "firkBatchID", cascade = CascadeType.PERSIST)
    private Collection<Firkins> firkCollection;
    @OneToMany(mappedBy = "brews")
    private Collection<BrewLab> brewLabCollection;

    public BrewView() {
    }

    public BrewView(Integer bid) {
        this.bid = bid;
    }

    public BrewView(Integer bid, int bState, Date bDate, float volLeft, int ganttColor, Date ganttStart, Date ganttSecond, Date ganttCond, Date ganttStop, int ganttPID, int ganttSID, int ganttCID, String ganttFGI, boolean ganttFilter, boolean ganttHarvest, Date ganttHarvestDate, boolean ganttFine, int version, int origBrew, Date cTDate, Date sFDate01, Date pDate, int pfvid, int sfvid, int cvid, int brewNoteID, int brewNoteID2, int brewNoteID3, int brewNoteID4, int brewNoteID5, int brewNoteID6) {
        this.bid = bid;
        this.bState = bState;
        this.bDate = bDate;
        this.volLeft = volLeft;
        this.ganttColor = ganttColor;
        this.ganttStart = ganttStart;
        this.ganttSecond = ganttSecond;
        this.ganttCond = ganttCond;
        this.ganttStop = ganttStop;
        this.ganttPID = ganttPID;
        this.ganttSID = ganttSID;
        this.ganttCID = ganttCID;
        this.ganttFGI = ganttFGI;
        this.ganttFilter = ganttFilter;
        this.ganttHarvest = ganttHarvest;
        this.ganttHarvestDate = ganttHarvestDate;
        this.ganttFine = ganttFine;
        this.version = version;
        this.origBrew = origBrew;
        this.cTDate = cTDate;
        this.sFDate01 = sFDate01;
        this.pDate = pDate;
        this.pfvid = pfvid;
        this.sfvid = sfvid;
        this.cvid = cvid;
        this.brewNoteID = brewNoteID;
        this.brewNoteID2 = brewNoteID2;
        this.brewNoteID3 = brewNoteID3;
        this.brewNoteID4 = brewNoteID4;
        this.brewNoteID5 = brewNoteID5;
        this.brewNoteID6 = brewNoteID6;
    }

    public Integer getBid() {
        return bid;
    }

    public void setBid(Integer bid) {
        this.bid = bid;
    }

    public int getbState() {
        return bState;
    }

    public void setbState(int bState) {
        this.bState = bState;
    }

    public Date getbDate() {
        return bDate;
    }

    public void setbDate(Date bDate) {
        this.bDate = bDate;
    }

    public float getVolLeft() {
        return volLeft;
    }

    public void setVolLeft(float volLeft) {
        this.volLeft = volLeft;
    }

    public int getGanttColor() {
        return ganttColor;
    }

    public void setGanttColor(int ganttColor) {
        this.ganttColor = ganttColor;
    }

    public Date getGanttStart() {
        return ganttStart;
    }

    public void setGanttStart(Date ganttStart) {
        this.ganttStart = ganttStart;
    }

    public Date getGanttSecond() {
        return ganttSecond;
    }

    public void setGanttSecond(Date ganttSecond) {
        this.ganttSecond = ganttSecond;
    }

    public Date getGanttCond() {
        return ganttCond;
    }

    public void setGanttCond(Date ganttCond) {
        this.ganttCond = ganttCond;
    }

    public Date getGanttStop() {
        return ganttStop;
    }

    public void setGanttStop(Date ganttStop) {
        this.ganttStop = ganttStop;
    }

    public int getGanttPID() {
        return ganttPID;
    }

    public void setGanttPID(int ganttPID) {
        this.ganttPID = ganttPID;
    }

    public int getGanttSID() {
        return ganttSID;
    }

    public void setGanttSID(int ganttSID) {
        this.ganttSID = ganttSID;
    }

    public int getGanttCID() {
        return ganttCID;
    }

    public void setGanttCID(int ganttCID) {
        this.ganttCID = ganttCID;
    }

    public String getGanttFGI() {
        return ganttFGI;
    }

    public void setGanttFGI(String ganttFGI) {
        this.ganttFGI = ganttFGI;
    }

    public boolean isGanttFilter() {
        return ganttFilter;
    }

    public void setGanttFilter(boolean ganttFilter) {
        this.ganttFilter = ganttFilter;
    }

    public boolean isGanttHarvest() {
        return ganttHarvest;
    }

    public void setGanttHarvest(boolean ganttHarvest) {
        this.ganttHarvest = ganttHarvest;
    }

    public Date getGanttHarvestDate() {
        return ganttHarvestDate;
    }

    public void setGanttHarvestDate(Date ganttHarvestDate) {
        this.ganttHarvestDate = ganttHarvestDate;
    }

    public boolean isGanttFine() {
        return ganttFine;
    }

    public void setGanttFine(boolean ganttFine) {
        this.ganttFine = ganttFine;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public int getOrigBrew() {
        return origBrew;
    }

    public void setOrigBrew(int origBrew) {
        this.origBrew = origBrew;
    }

    public Date getcTDate() {
        return cTDate;
    }

    public void setcTDate(Date cTDate) {
        this.cTDate = cTDate;
    }

    public Date getsFDate01() {
        return sFDate01;
    }

    public void setsFDate01(Date sFDate01) {
        this.sFDate01 = sFDate01;
    }

    public Date getpDate() {
        return pDate;
    }

    public void setpDate(Date pDate) {
        this.pDate = pDate;
    }

    public int getPfvid() {
        return pfvid;
    }

    public void setPfvid(int pfvid) {
        this.pfvid = pfvid;
    }

    public int getSfvid() {
        return sfvid;
    }

    public void setSfvid(int sfvid) {
        this.sfvid = sfvid;
    }

    public int getCvid() {
        return cvid;
    }

    public void setCvid(int cvid) {
        this.cvid = cvid;
    }

    public int getBrewNoteID() {
        return brewNoteID;
    }

    public void setBrewNoteID(int brewNoteID) {
        this.brewNoteID = brewNoteID;
    }

    public int getBrewNoteID2() {
        return brewNoteID2;
    }

    public void setBrewNoteID2(int brewNoteID2) {
        this.brewNoteID2 = brewNoteID2;
    }

    public int getBrewNoteID3() {
        return brewNoteID3;
    }

    public void setBrewNoteID3(int brewNoteID3) {
        this.brewNoteID3 = brewNoteID3;
    }

    public int getBrewNoteID4() {
        return brewNoteID4;
    }

    public void setBrewNoteID4(int brewNoteID4) {
        this.brewNoteID4 = brewNoteID4;
    }

    public int getBrewNoteID5() {
        return brewNoteID5;
    }

    public void setBrewNoteID5(int brewNoteID5) {
        this.brewNoteID5 = brewNoteID5;
    }

    public int getBrewNoteID6() {
        return brewNoteID6;
    }

    public void setBrewNoteID6(int brewNoteID6) {
        this.brewNoteID6 = brewNoteID6;
    }

    public POSBeerView getbBeerID() {
        return bBeerID;
    }

    public void setbBeerID(POSBeerView bBeerID) {
        this.bBeerID = bBeerID;
    }

    @XmlTransient
    public Collection<Barrels> getBarrelCollection() {
        return barrelCollection;
    }

    public void setBarrelCollection(Collection<Barrels> barrelCollection) {
        this.barrelCollection = barrelCollection;
    }

    @XmlTransient
    public Collection<TastePanelBeer> getTastePanelBeerCollection() {
        return tastePanelBeerCollection;
    }

    public void setTastePanelBeerCollection(Collection<TastePanelBeer> tastePanelBeerCollection) {
        this.tastePanelBeerCollection = tastePanelBeerCollection;
    }

    @XmlTransient
    public Collection<Firkins> getFirkinsCollection() {
        return firkCollection;
    }

    public void setFirkinsCollection(Collection<Firkins> firkCollection) {
        this.firkCollection = firkCollection;
    }

    @XmlTransient
    public Collection<BrewLab> getBrewLabCollection() {
        return brewLabCollection;
    }

    public void setBrewLabCollection(Collection<BrewLab> brewLabCollection) {
        this.brewLabCollection = brewLabCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bid != null ? bid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BrewView)) {
            return false;
        }
        BrewView other = (BrewView) object;
        if ((this.bid == null && other.bid != null) || (this.bid != null && !this.bid.equals(other.bid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.BrewView[ bid=" + bid + " ]";
    }
}
